package com.ymatou.iapi.livequery.testcase;

import org.json.JSONObject;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.livequery.service.GetSellerActivityCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.LiveCallService;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.MapUtil;

public class Ts_GetSellerActivity {
	private static String sellerName = EnvSetup.getData("productsellername");
	private static int sellerId = Integer.parseInt(EnvSetup.getData("productsellerid"));
	private static GetSellerActivityCall getSellerActivityCall = new GetSellerActivityCall();
	
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取卖家当前正在进行的直播");
	}

	@Before
	public void caseUp() {
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getSellerActivityCall.getOpurl());
	}
	
	
	@After
	public void caseDown() {
		Logger.end();
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetSellerActivity_001() {
		Logger.start(true, "获取卖家当前正在进行的直播");
		try{
			int liveId = LiveCallService.createLiveInProgress(sellerName, sellerId).getJSONObject("Data").getInt("ActivityId");
			JSONObject retBean = new GetSellerActivityCall().callAndGetReturnData(MapUtil.hashMap("SellerId", sellerId));
			Logger.verifyEquals(200,retBean.getInt("Code"),  "响应报文-返回码");
			Logger.verifyEquals(liveId,retBean.getJSONObject("Data").getInt("ActivityId"),"响应报文-Data");
			
			
		}catch (Exception e){
			Logger.fail(e);
		}
	}
}
